package com.neusoft.elm.service.impl;

import com.neusoft.elm.dao.BusinessDao;
import com.neusoft.elm.dao.impl.BusinessDaoImpl;
import com.neusoft.elm.po.Business;
import com.neusoft.elm.service.BusinessService;
import com.neusoft.elm.util.DBUtil;

import java.util.ArrayList;
import java.util.List;

public class BusinessServiceImpl implements BusinessService {


    @Override
    public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) throws Exception {
        BusinessDao businessDao=new BusinessDaoImpl();
        try {
            DBUtil.getConnection();
            List<Business>businessList=businessDao.listBusinessByOrderTypeId(orderTypeId);


            return businessList;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
    }

    @Override
    public Business getBusinessById(Integer businessId) throws Exception {

        BusinessDao dao = new BusinessDaoImpl();
        Business business=new Business();
        try {

            DBUtil.getConnection();
             business = dao.getBusinessById(businessId);
        }
        catch(Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
      return business;
    }
}
